<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        #son {
            position: absolute;
            left: 0;
            top: 0;
            background-color: red;
            width: 100px;
            height: 100px;
        }
    </style>

</head>

<body>

    <div id="son"></div>

</body>

<script>
    var son = document.getElementById('son');


    function dhhs(obj, taget) {
        var s = setInterval(function() {
            obj.style.left = son.offsetLeft + 5 + 'px';
            if (son.offsetLeft == taget) {
                clearInterval(s);
            }
        }, 30);
    }

    dhhs(son, 100);
</script>

</html>